#define _CRT_SECURE_NO_WARNINGS
#include"stdio.h"
#include"math.h"
int main() {
	for (int i = 0; i <= 100000; i++) {
		int count = 0;
		int temp = i;
		while (temp != 0) {
			count++;
			temp /= 10;
		}
		temp = i;
		int sum = 0;
		while (temp != 0) {
			sum += pow(temp % 10, count);//pow(a,b)->a^b
			temp /= 10;
			if (sum == i) {
				printf("%d\n", i);
			}
		}
	}
	return 0;
}